﻿
/*

Copyright (c) 2012 Lucas Agudiez (Agu10)

Online Math Calculator is released under the MIT license.
See the file license.txt for copying permission.


 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;

namespace Online_Math
{
    public partial class BugReport : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        protected void sendBugReportButton_Clicked(object sender, EventArgs e)
        {
            // We write the bug report to an html file to read later.
            try
            {
                string text = "";

                StreamWriter writer = new StreamWriter(Server.MapPath(".") + "/bugs.html", true);
                text += "Name: " + nameText.Text + "<br/>";
                text += "Email: " + mailText.Text + "<br/>";
                text += "Comments:" + "<br/>";
                text += commentsText.Text + "<br/>";
                text += "-----------------------------------------------<br/><br/><br/><br/><br/>";
                writer.Write(text);
                writer.Close();
                thanksLabel.Text = "<h1>Thanks!</h1><br/>"+text;
                sendBugPanel.Visible = false;
            }
            catch (Exception ex)
            {
                Response.Write("<h1>ERROR</h1><script>alert('"+ ex.Message + "');</script>");
                
            }
        }
    }
}
